(function(win, $){
    var setFormResult = win.setFormResult = function (data) {
        //console.log(data);
        layer.closeAll();
        if(data.status != 10000) {
            layer.alert(data.errmsg, {icon: 5});
        } else {
            layer.confirm('发布成功！', {icon: 6, title:'系统提示', btn: ['OK']}, function(index){
                parent.location.reload(true);
            });
        }
    };
    $(function(){
        !function(){
            laydate.skin('danlan');
            var start = {
                elem: '#activity_start_time',
                format: 'YYYY-MM-DD hh:mm:ss',
                min: laydate.now(),
                max: '2099-06-16 23:59:59', //最大日期
                istime: true,
                istoday: false,
                choose: function(datas){
                    end.min = datas; //开始日选好后，重置结束日的最小日期
                    end.start = datas; //将结束日的初始值设定为开始日
                }
            };
            var end = {
                elem: '#activity_end_time',
                format: 'YYYY-MM-DD hh:mm:ss',
                min: laydate.now(),
                max: '2099-06-16 23:59:59',
                start: '23:00:00',    //开始日期
                istime: true,
                istoday: false,
                choose: function(datas){
                    start.max = datas; //结束日选好后，重置开始日的最大日期
                }
            };
            laydate(start);
            laydate(end);
        }();


        $('#form_update').on('valid.form', function(e, form){
            layer.load();
            form.submit();
        });
    });
})(window, jQuery);